package com.library_manage_system.view;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Iterator;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.library_manage_system.base.Observer;
import com.library_manager_system.Book;
import com.library_manager_system.utils.GetBookByName;
import com.library_manager_system.utils.LibraryDao;
import com.library_manager_system.utils.PanelFactory;
import com.library_manage_system.strategy.PanelStrategy;

public class BookDataLoggingPanel implements Observer {
	public static  WindowsMainImpl windowsMainImpl;
	
	private static BookDataLoggingPanel uniqueInstance;
	public static BookDataLoggingPanel getInstance(WindowsMainImpl windowsMainImpl){
		if(uniqueInstance== null){
			uniqueInstance = new  BookDataLoggingPanel(windowsMainImpl);
		}
		return uniqueInstance;
	}
	
	public BookDataLoggingPanel(WindowsMainImpl windowsMainImpl){
		this.windowsMainImpl = windowsMainImpl;
		windowsMainImpl.registerObserver(this);
		
	}
	public  static PanelStrategy strategy;
	public void SetPanelStrategy(PanelStrategy strategy ){
		this.strategy = strategy;
	}

	@Override
	public JPanel update(ArrayList<Book> list, WindowsMainImpl windowsMainImpl) {
		// TODO Auto-generated method stub
		return uniqueInstance.strategy.createPanel(list, windowsMainImpl);
	}

}
